package com.lm.netty.service;

import com.lm.netty.myInterface.MultiTransactional;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.HashMap;


/**
 * @author 11630
 */
@Component("Test")
public class Test {

    @Resource(name = "doubanJdbcTemplate")
    private JdbcTemplate doubanJdbcTemplate;

    @Resource(name = "movieJdbcTemplate")
    private JdbcTemplate movieJdbcTemplate;


    @MultiTransactional(values = {"doubanTransactionManager","movieTransactionManager"})
    public void test(){
        String sql = "insert into t_test(name) values (?)";
        doubanJdbcTemplate.update(sql,"-----");
        new HashMap<>().get("---").toString();
        movieJdbcTemplate.update(sql,"-----");
    }
}
